//
//  ALAsset+FullResolutionImage.m
//  OntheRoadV4
//
//  Created by ZhangYanhua on 15/5/18.
//  Copyright (c) 2015年 EricHuang. All rights reserved.
//

#import "ALAsset+FullResolutionImage.h"
#import <UIKit/UIKit.h>

@implementation ALAsset (FullResolutionImage)

- (UIImage *)assetFullResolutionImageWithFilter
{
    UIImage *_image = nil;

    @autoreleasepool {
        ALAssetRepresentation *defaultRep = [self defaultRepresentation];
        
        NSString *xmpString = defaultRep.metadata[@"AdjustmentXMP"];
        if ([xmpString length] > 0) {
            _image = [UIImage imageWithCGImage:[defaultRep fullScreenImage]];
        } else {
            _image = [UIImage imageWithCGImage:[defaultRep fullResolutionImage] scale:defaultRep.scale orientation:(UIImageOrientation)defaultRep.orientation];
        }
    }

    return  _image;
}

@end
